package com.xhwl.data.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.dto.cent.sdata.AreaDTO;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.Area;
import com.xhwl.common.query.cent.sdata.AreaQuery;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: luyi
 * @Description: 区域，校区
 * @Date: Create in 15:13 2021/1/21
 */
@RestController
public interface IAreaService extends IService<Area> {

    /**
     * 创建区域
     *
     * @param areaDTO
     * @return
     */
    @RequestMapping(value = "/area-service/create", method = RequestMethod.POST)
    ResultJson create(@RequestPart AreaDTO areaDTO);

    /**
     * 更新校区
     *
     * @param areaDTO
     * @return
     */
    @RequestMapping(value = "/area-service/update", method = RequestMethod.POST)
    ResultJson update(@RequestPart AreaDTO areaDTO);

    ResultJson refreshSort(AreaQuery areaQuery);
    /**
     * 分页查询
     *
     * @param areaQuery
     * @param page
     * @return
     */
    @RequestMapping(value = "/area-service/page", method = RequestMethod.POST)
    Page<Area> page(@RequestPart(required = false) AreaQuery areaQuery, @RequestPart Page page);

    /**
     * 删除
     *
     * @param id
     * @param account
     * @return
     */
    @RequestMapping(value = "/area-service/delete", method = RequestMethod.POST)
    ResultJson delete(@RequestPart Integer id, Account account);

    /**
     * 列表查询
     *
     * @param areaQuery
     * @return
     */
    @RequestMapping(value = "/area-service/list", method = RequestMethod.POST)
    List<Area> list(@RequestPart(required = false) AreaQuery areaQuery);

    /**
     * 单个查询
     *
     * @param areaQuery
     * @param account
     * @return
     */
    @RequestMapping(value = "/area-service/one", method = RequestMethod.POST)
    Area one(@RequestPart(required = false) AreaQuery areaQuery, @RequestPart(required = false) Account account);

    /**
     * 批量创建
     *
     * @param areas
     * @return
     */
    ResultJson batchCreate(List<AreaDTO> areas);

	/**
	 * 批量创建
	 * @param areaDTOS
	 * @return
	 */
	ResultJson batchCreateFaster(List<AreaDTO> areaDTOS);
}
